<template>
  <div>
  <h1>工序管理</h1>
    <el-form :inline="true" :model="queryProcess" class="demo-form-inline">
      <el-form-item label="工序名">
        <el-input v-model="queryProcess.name" placeholder="工序名"></el-input>
      </el-form-item>
      <el-form-item label="条形编号">
        <el-input v-model="queryProcess.number" placeholder="条形编号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="list">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table
        :data="tableData"
        stripe
        style="width: 100%">
      <el-table-column
          prop="id"
          label="编号"
          width="180">
      </el-table-column>
      <el-table-column
          prop="name"
          label="工序名"
          width="180">
      </el-table-column>
      <el-table-column
          prop="number"
          label="编号">
      </el-table-column>
      <el-table-column
          prop="price"
          label="默认单价">
      </el-table-column>
      <el-table-column
          label="是否外协工序">
        <template v-slot="s">
          <el-tag v-if="s.row.outsourcingProcess==0">是</el-tag>
          <el-tag v-if="s.row.outsourcingProcess==1">否</el-tag>
        </template>
      </el-table-column>
      <el-table-column
          label="是否必检工序">
        <template v-slot="s">
          <el-tag v-if="s.row.checkProcess==0">是</el-tag>
          <el-tag v-if="s.row.checkProcess==1">否</el-tag>
        </template>
      </el-table-column>
      <el-table-column
          label="状态">
        <template v-slot="s">
          <el-tag v-if="s.row.status==0">正常</el-tag>
          <el-tag v-if="s.row.status==1">异常</el-tag>
        </template>
      </el-table-column>
      <el-table-column
          prop="bname"
          label="班组">
      </el-table-column>
      <el-table-column
          prop="sort"
          label="排序">
      </el-table-column>
      <el-table-column
          prop="remark"
          label="备注">
      </el-table-column>
    </el-table>
    <el-pagination
        @current-change="handleCurrentChange"
        :page-size="size"
        layout="total, prev, pager, next"
        :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "ProcessView",
  data() {
    return {
      tableData:{},
      current:1,
      size:2,
      total:0,
      queryProcess:{}
    }
  }, methods: {
    handleCurrentChange(current){
      this.current=current;
      this.list();
    },
    list(){
      this.axios.post("/process/list?current="+this.current+"&size="+this.size,this.queryProcess).then(r =>{
        this.tableData=r.data.data.list;
        this.total=r.data.data.total;
      })
    }
  }, created() {
  this.list();
  }
}
</script>

<style scoped>

</style>